package com.lianbang.staff.model

import cn.ubest.mvvmcore.base.BaseModel
import cn.ubest.mvvmcore.bean.ResultWrapper
import cn.ubest.mvvmcore.bean.Wrapper
import com.lianbang.staff.bean.CheckCodeBean
import com.lianbang.staff.bean.UserBean
import com.lianbang.staff.http.api.UserApi

/**
 * Created by maoqi on 2021/1/13.
 */
class UserModel : BaseModel() {
    private val c = UserApi::class.java

    suspend fun login(account: String, pwd: String): ResultWrapper<UserBean> {
        return createService(c).login(account, pwd)
    }

    suspend fun changePassword(oldPwd: String, newPwd: String, confirmPwd: String)
            : Wrapper {
        return createService(c).changePassword(oldPwd, newPwd, confirmPwd)
    }

    //找回密码
    suspend fun findPassword(
        mobile: String,
        auth_token: String,
        newPwd: String,
        confirmPwd: String
    ): Wrapper {
        return createService(c).findPassword(mobile, auth_token, newPwd, confirmPwd)
    }

    //找回密码
    suspend fun checkFindPasswordCode(
        mobile: String,
        code: String
    ): ResultWrapper<CheckCodeBean> {
        return createService(c).checkFindPasswordCode(mobile, code)
    }

    //发送验证码
    suspend fun sendCode(
        mobile: String,
        sms_auth: String,
        type: String
    ): Wrapper {
        return createService(c).sendCode(mobile, sms_auth, type)
    }
}